Let's redefine the Person class to be derived from the Generic_Class:
struct Person:Generic_Class
{
int age;
int weight;
void set(void); /* in C++ use 'virtual void set(void)' */
void print(void); /* in C++ use 'virtual void print(void)' */
};
Now both the Person and Student classes inherit the init() and destroy() methods.
To clarify program structure, ease code reusability, and speed up development (via separate compilation), it is customary to place the definition of each class in a separate header file* and to place the definitions for a given class' methods in a separate source file. This will be demonstrated in the example at the end of the chapter.